<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
            xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro"
>
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>
<h3>首页</h3>
<p th:text="${msg}"><p/>
<div>
    <div style="float: right">
<!--        <p th:text="${username}"></p>-->
        <div th:if="${session.loginUser!=null}">
<!--            通过session获取用户信息,注意:方法名后边不能有： ()-->
            <p th:text="${session.loginUser.getUsername}"></p>

        </div>

        <div  th:if="${session.loginUser==null}" >
             <a th:href="@{/toLogin}">登录</a>
        </div>
        <div  th:if="${session.loginUser!=null}">
            <a th:href="@{/logout}">注销</a>
        </div>
    </div>

    <div shiro:hasPermission="user:add">

        <a th:href="@{/user/add}">add</a>

    </div>
    <div shiro:hasPermission="user:update">
        <a th:href="@{/user/update}">update</a>

    </div>

</div>
</body>
</html>
